Skip to content

feat(core): implement type testing infrastructure#255

Merged
AliiiBenn merged 3 commits intomainfrom
feat/implement-type-testing
Apr 1, 2026
Merged

feat(core): implement type testing infrastructure#255
AliiiBenn merged 3 commits intomainfrom
feat/implement-type-testing

Conversation

@AliiiBenn
Copy link
Copy Markdown
Member

Summary

Implement type testing infrastructure for @deessejs/core using @deessejs/type-testing.

Changes

  • Install @deessejs/type-testing as dev dependency
  • Create type test files for Result, Maybe, Error, AsyncResult, and Try types
  • Add vitest typecheck configuration for compile-time type verification
  • Create tsconfig.types.json for type test compilation
  • Improve swap() function documentation explaining type limitations
  • Add unit.test.ts with 12 tests for Unit singleton
  • Add istanbul ignore comments to retry.ts unreachable throws
  • Reorganize tests into unit/ and types/ subdirectories
  • Update ESLint config to exclude *.test-d.ts files

Type Tests Created

File Purpose
result.types.test-d.ts Result union types, Ok/Err, ExtractResultError
maybe.types.test-d.ts Maybe union types, Some/None
error.types.test-d.ts Error intersection types, ErrorBuilder, ExtractError
async-result.types.test-d.ts AsyncResult Thenable interface, AbortError
try.types.test-d.ts Try union types, TrySuccess/TryFailure

Test Results

  • Total tests: 513 (up from 501)
  • Test files: 16 (11 unit + 5 type)
  • Type Errors: none

Test plan

  • All 513 tests pass
  • Lint passes
  • Typecheck passes
  • Coverage improved for unit.ts (was 55%, now tested)

AliiiBenn and others added 2 commits April 1, 2026 10:51
Add @deessejs/type-testing for compile-time type verification.

Changes:
- Install @deessejs/type-testing as dev dependency
- Create type test files for Result, Maybe, Error, AsyncResult, and Try types
- Add vitest typecheck configuration in vitest.config.ts
- Create tsconfig.types.json for type test compilation
- Improve swap() function documentation explaining type limitations
- Reorganize tests into unit/ and types/ subdirectories

Type tests verify:
- Result<T, E> = Ok<T, E> | Err<E> union type
- Success<T> = Result<T, never> alias
- Maybe<T> = Some<T> | None union type
- ExtractResultError and ExtractError conditional types
- Error<T> intersection type structure
- AsyncResult Thenable interface
- Try<T, E> union type

Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
Apply recommendations from test quality report:

1. Add unit.test.ts with 12 tests for Unit singleton
   - Test isUnit() with singleton
   - Test isUnit() with various types (null, undefined, numbers, strings, etc.)
   - Test cross-realm Unit detection with same Symbol.for key
   - Test that objects without UNIT_BRAND return false

2. Add istanbul ignore comments to retry.ts unreachable throws
   - Lines 144-145 and 202-203
   - These are TypeScript exhaustive checks, unreachable at runtime

Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
@AliiiBenn AliiiBenn added feature New functionality ready Ready to work on priority:medium Normal priority effort:m 1-3 days labels Apr 1, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
core-web Ready Ready Preview, Comment Apr 1, 2026 9:07am

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

Coverage Report

Metric Coverage
Lines 96.5%
Statements 96.5%
Functions 89.4%
Branches 95.09%

Coverage report generated by GitHub Actions

@AliiiBenn AliiiBenn merged commit e734e99 into main Apr 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort:m 1-3 days feature New functionality priority:medium Normal priority ready Ready to work on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant